<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const promise1 = new Promise((resolve, reject) => {
        setTimeout(() => {
          resolve("success");
          console.log("timer1");
        }, 1000);
        console.log("promise1里的内容");
      });
      const promise2 = promise1.then(() => {
        throw new Error("error!!!");
      });
      console.log("promise1", promise1);
      console.log("promise2", promise2);
      setTimeout(() => {
        console.log("timer2");
        console.log("promise1", promise1);
        console.log("promise2", promise2);
      }, 2000);

      const p = Promise.reject()
        .then(() => {
          console.log(1);
          return 1;
        })
        .catch(() => {
          console.log(2);
        })
        .then((res) => {
          console.log(res);
          console.log(3);
          return 3;
        });
    </script>
  </body>
</html>
